<?php

//后台的配置文件
include(dirname(__FILE__).'/config.php');
//include(dirname(__FILE__).'/../Inc/tree.class.php');



$dopost = isset($_REQUEST['dopost']) ? trim($_REQUEST['dopost']) : '';


if( $dopost == 'save' ){
	$post = $_POST;
	

	$post = sec($post);
	foreach ($post as $k => $v ) {
		# code...
		$art = array();
		$art['varname'] = $k;
		$art['value'] = $v;
		
		if( $rs = dbList("select * from `config` where `varname` =  '$k' ")){
			 $rs = dbUpdate('config', $art , " `varname` =  '$k' " );
		}else{
			 $rs = dbInsert('config', $art);
		}

	}
	die('{"ret":0,"msg":"保存成功！！！","url":"?t='.time().'"}') ;
//***************************************************************
}else{


	$art = dbList("select * from `config` where 1 order by id asc");
	$cfg = array();
	foreach($art as $k=>$v){
		$cfg[ $v['varname'] ] = $v['value'];
	}

	include('temp/web_config.php');

}



